# Replication code for Stommes, Aronow, and Sävje "On the reliability of published findings using the regression discontinuity design in political science"

To replicate all analyses in the paper, do the following:

1. Populate the `raw-data` folder.

2. Install necessary packages.

3. Run `master.sh`.


### Populate raw data

Due to its large size and limited redistribution rights, the raw data have not been included in the replication package. Please reach out to us to arrange access to the raw data if you are interested. Most of the data are publicly available, but some was acquired directly from the original authors.

The replication package contains a manifest of all raw data files, including md5 hashes.


### Required packages

The following packages are used in the analysis:
```
ggplot2
plyr
RDHonest (version 0.3.2, commit "6de8ae1" of kolesarm/RDHonest)
rdpower (version 2.2)
rdrobust (version 2.1.1)
reshape2
readstata13
sandwich
stringr
tidyverse
tools
```

Please refer to `session-info.txt` for version information.


### Run analysis

Run the following command in your terminal:
```
./master.sh
```

This file also documents run order in case you want to replicate the analysis file by file.


### Overview files

```
data/cl-replication-data/.            : Folder containing cleaned data sets for all studies included in the reanalysis
data/cl-rd-papers-meta.csv            : Cleaned data set with meta data
data/meta-replication.csv             : Replicated original analyses when missing meta data (see `clean-meta-replication.R`)
data/reanalysis-results.csv           : Results from the reanalysis
manifests/cl-replication-data.txt     : Manifest of the files in `data/cl-replication-data/`
manifests/raw-data.txt                : Manifest of the files in `raw-data/`
output/.                              : Folder containing tables and figures that appear in the paper
raw-data/intermediate-clean/.         : Folder containing data sets requiring intermediate cleaning in Stata
raw-data/replication-raw-data/.       : Folder containing all raw data sets
raw-data/rd-papers-meta.csv           : Data set with meta data collected by us
raw-data/rd-papers-vars.csv           : Data set with information needed for reanalysis
clean-meta-data.R                     : Generates `data/cl-rd-papers-meta.csv`
clean-meta-replication.R              : Generates `data/meta-replication.csv`
clean-replication-data.R              : Populates `data/cl-replication-data/`
generate-manifests.sh                 : Generates the manifests in `manifests/`
make-caliper-tests-tables.R           : Makes tables with caliper test results
make-funnel-plots.R                   : Makes funnel plots
make-misc-plots.R                     : Makes p-value plots
make-tables.R                         : Makes tables (including power analysis)
make-tstat-plots.R                    : Makes t-stat plots
master.sh                             : Runs all steps of the analysis, including cleaning
print-session-info.R                  : Loads all used packages and prints the current session information
README.md                             : This file
run-reanalysis.R                      : Runs the reanalysis (approx. run time is 12 hours)
session-info.txt                      : Output from `print-session-info.R `, generated when `master.sh` is called
```
